import { http } from "@/utils/http";
import type { MrpUserSaleDataItem, BaseConfigDetailItem } from "./index.d";
import type { PagingParames, PagingRes } from "@/api/public/index.d";

/** 获取列表 */
export const getMrpUserSaleData = (params: PagingParames) => {
  return http.request<PagingRes<MrpUserSaleDataItem[]>>(
    "get",
    "/customer/mrpUserSaleData/list",
    {
      params
    }
  );
};

/** 修改备货数量 */
export const setUserPrepareStockNum = (data: {
  ids: string[] | number[];
  user_prepare_stock_num: string | number;
}) => {
  return http.request<never>(
    "post",
    "/customer/mrpUserSaleData/setUserPrepareStockNum",
    {
      data
    }
  );
};

/** 获取基本配置列表 */
export const getBaseConfigDetail = () => {
  return http.request<BaseConfigDetailItem[]>(
    "get",
    "/customer/mrpUserBaseConfig/detail"
  );
};

/** 重新生成 */
export const setMrpUserSaleDataRebuild = () => {
  return http.request<never>("post", "/customer/mrpUserSaleData/generate");
};

/** 导出 */
export const mrpUserSaleDataExport = (params: { [key: string]: any }) => {
  return http.request<never>("get", "/customer/mrpUserSaleData/export", {
    params
  });
};
